package com.macro.mall.controller;

import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.common.util.ExceptionUtils;
import com.macro.mall.dto.OmsReturnApplyQueryParam;
import com.macro.mall.model.OmsOrderReturnApply;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@Tag(name = "ErrorController", description = "实现Controller接收过过滤器发来的异常")
@RequestMapping("/error")
public class ErrorController {
    @Operation(summary = "接口错误转发接口")
    @RequestMapping(value = "/exThrow", method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public CommonResult<?> exThrow(HttpServletRequest request) {
        return CommonResult.failed(ExceptionUtils.getRootCauseMessage((Exception) request.getAttribute("filter_error")));
    }


}
